package com.whfc.openapi.api.fvs.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.whfc.openapi.api.fvs.service.FvsCallbackService;

/**
 * @Description:
 * @author: xugcheng
 * @version: 1.0
 * @date: 2019/10/21 20:11
 */
@RestController
@RequestMapping(value = "open/api/fvs")
public class FvsCallbackController {

    private Logger logger = LoggerFactory.getLogger(this.getClass());
    
    @Autowired
    private FvsCallbackService fvsCallbackService;

    @PostMapping(value = "/gb28181/record/callback")
    public String recordCallback(@RequestBody String body) {
        logger.info("GB28181视频录制回调:{}", body);
        fvsCallbackService.recordCallback(body);
        return "ok";
    }

    @PostMapping(value = "/gb28181/snapshot/callback")
    public String snapshotCallback(@RequestBody String body) {
        logger.info("GB28181视频截图回调:{}", body);
        fvsCallbackService.snapshotCallback(body);
        return "ok";
    }
    
    @PostMapping(value = "/gb28181/groupState/callback")
    public Integer groupCallback(@RequestBody String body) {
    	 logger.info("GB28181空间状态回调:{}", body);
    	 fvsCallbackService.groupCallback(body);
    	 return 200;
    }

    @PostMapping(value = "/rtmp/record/callback")
    public String rtmpRecordCallback(@RequestBody String body) {
        logger.info("RTMP视频录制回调:{}", body);
        fvsCallbackService.rtmpRecordCallback(body);
        return "ok";
    }

    @PostMapping(value = "/rtmp/snapshot/callback")
    public String rtmpSnapshotCallback(@RequestBody String body) {
        logger.info("RTMP视频截图回调:{}", body);
        fvsCallbackService.rtmpSnapshotCallback(body);
        return "ok";
    }

    @PostMapping(value = "/rtmp/groupState/callback")
    public Integer rtmpGroupCallback(@RequestBody String body) {
        logger.info("RTMP空间状态回调:{}", body);
        fvsCallbackService.rtmpGroupCallback(body);
        return 200;
    }
    
}
